<!DOCTYPE html>
<html class="x-admin-sm">
  <head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link rel="stylesheet" href="__ADMIN__/css/font.css">
    <link rel="stylesheet" href="__ADMIN__/css/xadmin.css">
    <script type="text/javascript" src="__ADMIN__/js/jquery.min.js"></script>
    <script type="text/javascript" src="__ADMIN__/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="__ADMIN__/js/xadmin.js"></script>
    <script type="text/javascript" src="__ADMIN__/js/cookie.js"></script>
    <style>
        .layui-btn+.layui-btn{
            margin-left: 0;
        }
        .layui-table td, .layui-table th
        {
            min-width: 50px !important;
        }
.layui-btn-xs {
    height: 22px !important;
    line-height: 22px !important;
    padding: 0 5px !important;
    font-size: 12px;
}

        .layui-table-box .layui-table-body .layui-table tr td:nth-child(8){background-color:#009688;color:#fff}
        .layui-table-box .layui-table-body .layui-table tr td:nth-child(13){background-color:#ddebf7}
        .layui-table-box .layui-table-body .layui-table tr td:nth-child(12){background-color:#ddebf7}
        .layui-table-box .layui-table-body .layui-table tr td:nth-child(11){background-color:#ddebf7}
    </style>
  </head>
  
  <body>
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a><cite>{$nav}</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon layui-icon-refresh-3" style="line-height:30px"></i></a>
    </div>
    <div class="x-body x-admin">

      <xblock style="display: flex;">
        
        <div class="layui-card-body" style="padding-left: 0;float:left;padding-left:20px;padding-top:0;">
          <form class="layui-form layui-col-space5" action="" method="get">
            <div class="layui-inline layui-show-xs-block">
              <input style="width:260px;" type="text" name="keyword" id="keyword" value="{:input()['keyword']}" placeholder="活动名称，地点，手机号，营销姓名" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-inline layui-show-xs-block">
                <select name="step">
                <option value="">全部</option>
                <option value="4" {:input('step')==4?'selected':''}>待结算</option>
                <option value="5" {:input('step')==5?'selected':''}>已结算</option>
                </select>
            </div>

              <div class="layui-inline">
                  <label>直播日期选择</label>
                  <div class="layui-input-inline">
                      <input type="text" name="start_date" id="start_date" value="{if condition="input('start_date')"}{:input('start_date')}{/if}" autocomplete="off" class="layui-input">
                  </div>
              </div>
              <div class="layui-inline">
                  <label>至</label>
                  <div class="layui-input-inline">
                      <input type="text" name="end_date" id="end_date" value="{if condition="input('end_date')"}{:input('end_date')}{/if}" autocomplete="off" class="layui-input">
                  </div>
              </div>

            <div class="layui-inline layui-show-xs-block">
              <button class="layui-btn" id="search-btn">搜索</button>
            </div>
          </form>
        </div>
      </xblock>

        <!--<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">-->
        <!--  <legend>直播结算表</legend>-->
        <!--</fieldset>-->
        <div class="layui-table-body layui-table-main" style="width: 100%;min-height:0;">
            <table class="layui-table layui-form" lay-filter="liveDetail" id="liveDetail"> </table>
        </div>
    </div>
    <script type="text/html" id="status-td">
    {{#  if(d.step == 0){ }}
    待联系
    {{#  } else if (d.step == 1){ }}
    待确认
    {{#  } else if (d.step == 2){ }}
    待审核
    {{#  } else if (d.step == 3){ }}
    已审核
    {{#  } else if (d.step == 4){ }}
    待结算
    {{#  } else if (d.step == 5){ }}
    已结算
    {{#  } }}
    </script>
    <script type="text/html" id="do-td">
    {{#  if(d.step == 4){ }}
    <a class="layui-btn layui-btn-xs layui-btn-primary" lay-event="view">详情</a>
    <a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="jie">结算</a>
    {{#  } else if (d.step == 5){ }}
    <a class="layui-btn layui-btn-xs layui-btn-primary" lay-event="view">详情</a>
    {{#  } }}
    </script>
    <script type="text/html" id="rate_1">
    {{#  if(d.rate_1 < 61){ }}
    <font color="#f00">★{{d.rate_1}}</font>
    {{#  } else if (d.rate_1 < 90){ }}
    <font color="#f00">{{d.rate_1}}</font>
    {{#  } else{ }}
    {{d.rate_1}}
    {{#  } }}
    </script>
    <script type="text/html" id="rate_2">
    {{#  if(d.rate_2 < 61){ }}
    <font color="#f00">★{{d.rate_2}}</font>
    {{#  } else if (d.rate_2 < 90){ }}
    <font color="#f00">{{d.rate_2}}</font>
    {{#  } else{ }}
    {{d.rate_2}}
    {{#  } }}
    </script>
    <script type="text/html" id="rate_3">
    {{#  if(d.rate_3 < 61){ }}
    <font color="#f00">★{{d.rate_3}}</font>
    {{#  } else if (d.rate_3 < 90){ }}
    <font color="#f00">{{d.rate_3}}</font>
    {{#  } else{ }}
    {{d.rate_3}}
    {{#  } }}
    </script>
    <script type="text/html" id="toolbarDemo">
    </script>
    <script type="text/html" id="canBill">
    {{#  if(d.canBill == -1){ }}
    不能
    {{#  } else if (d.canBill == 1){ }}
    能
    {{#  } }}
    </script>
    <script type="text/html" id="billImage">
    <a href="{{d.bill_image}}" target="_blank"><img src="{{d.bill_image}}" height="28"></a>
    </script>
    <script type="text/html" id="voucherImage">
    <a href="{{d.voucher_image}}" target="_blank"><img src="{{d.voucher_image}}" height="28"></a>
    </script>
    <script type="text/html" id="price_sign">
    {{#  if(d.jie_price && (d.liveer_price != d.jie_price )){ }}
    <font color="#f00">{{d.jie_price}}</font>
    {{#  } else { }}
    {{d.jie_price}}
    {{#  } }}
    </script>
    
    <script>

      layui.use(['form','layer','jquery','table','util','laydate'], function(){
        form = layui.form,
        layer = layui.layer
        ,$ = layui.jquery
        ,table = layui.table
        ,util = layui.util
        ,laydate = layui.laydate;

          table.render({
            elem: '#liveDetail'
//            ,url:'{:url('admin/dataTable/liveProcess')}?step={:input('step')?:'4,5'}&keyword={:input('keyword')}'
            ,url:'{:url('admin/dataTable/liveProcess')}?step={:input('step')?:'4,5'}&keyword={:input('keyword')}&start_date={:input('start_date')}&end_date={:input('end_date')}'
            ,toolbar: '#toolbarDemo'
            ,defaultToolbar: ['filter', 'exports', 'print']
            ,limit: 50
            ,height: $(window).height()-150
            ,title: '直播结算表'
            ,cols: [
                [
                {align: "center", title:"<h2>直播执行详情</h2>" ,colspan:10},
                {align: "center", title:"评价情况" ,colspan:3},
                ],
            [
              //{field:'id', width:70, sort: true,title:"编号"},
              {field:'admin_name', width:80,title:"营销"},
              {field:'live_id',width:80,title:"活动ID"},
              {field:'activity_name',width:363, title:"活动名称"},
              {field:'activity_date', width:180,title:"直播日期"},
              //{field:'activity_time', width:110,title:"直播时间段"},
              {field:'activity_area', width:180,title:"地区"},
              {field:'activity_venues', width:100,title:"活动场馆"},
              //{field:'activity_address', width:180,title:"场馆地址"},
              {field:'activity_need_device', width:120,title:"设备需求"},
              //{field:'note', width:150,title:"备注"},
              {field:'liveer_price', width:70,title:"报价"},
              { width:70,title:"结算价",templet:"#price_sign"},
              
              //{field:'liveer_name', width:200,title:"外请直播联系人"},
              //{field:'liveer_phone', width:200,title:"外请直播联系人电话"},
              //{field:'liveer_bill', width:100,title:"能否开票" ,templet:"#canBill" },
              
              //{field:'bill_image', width:200,title:"发票图" ,templet:"#billImage"},
              //{field:'voucher_image', width:200,title:"转账凭证" ,templet:"#voucherImage"},
              //{field:'jie_method', width:200,title:"转账方式"},
              //{field:'transferor', width:200,title:"转账人"},
              
              
              { width:100,title:"状态",  toolbar: '#status-td'},
              { width:110,title:"操作",  toolbar: '#do-td'},

              {field:'rate_1', width:70,title:"声音" ,templet:"#rate_1"},
              {field:'rate_2', width:70,title:"画面" ,templet:"#rate_2"},
              {field:'rate_3', width:70,title:"服务" ,templet:"#rate_3"},
              {field:'jie_method', width:70,title:"转账方式" {if session('group_id','','admin')==1},edit: 'text'{/if} },
              {field:'transferor', width:90,title:"转账人" {if session('group_id','','admin')==1},edit: 'text'{/if} },
            ]]
            ,page: true
          });

          table.on('edit(liveDetail)', function(obj){
            var value = obj.value 
            ,data = obj.data 
            ,field = obj.field;
            console.log(obj);
            $.post('{:url('dataTable/liveDetailEdit')}',{id:data.id, field:field,value:value},function(obj){
                layer.msg(obj.msg);
            },'json');
            
            //layer.msg('[ID: '+ data.id +'] ' + field + ' 字段更改值为：'+ util.escape(value));
          });

          table.on('tool(liveDetail)', function(obj){
            var data = obj.data;
             if(obj.event == 'jie'){
              x_admin_show('查看详情','{:url('dataTable/liveProcessJie')}/id/'+data.id,'','650','750')
            } else if(obj.event == 'view'){
              x_admin_show('查看详情','{:url('dataTable/liveProcessView')}/id/'+data.id,'','650','750')
            }
          });
          
            table.on('edit(liveDetail)', function(obj){
                var value = obj.value 
                ,data = obj.data 
                ,field = obj.field; 
                $.get('{:url('dataTable/liveDetailEditQuick')}?id='+data.id+'&field='+field+'&value='+util.escape(value),function(data){
                    layer.msg(data.msg);
                })
                
                //layer.msg('[ID: '+ data.id +'] ' + field + ' 字段更改值为：'+ util.escape(value));
            });

          laydate.render({
              elem: '#start_date'
          });
          laydate.render({
              elem: '#end_date'
          });
      });

    </script>
  </body>

</html>